package com.lidong.lowcode.core.service.system.impl;

import com.lidong.lowcode.base.component.FunctionMenu;
import com.lidong.lowcode.base.domain.MenuVO;
import com.lidong.lowcode.core.service.system.CoreHelperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 5/2/2022 11:09 AM
 */
@Service
public class CoreHelperServiceImpl implements CoreHelperService {

    @Autowired(required = false)
    private List<FunctionMenu> functionMenus;

    /**
     * 获取各个模块注册的菜单
     *
     * @return List
     */
    @Override
    public List<MenuVO> getExternalMenu() {
        List<MenuVO> menus = new ArrayList<>();
        for (FunctionMenu functionMenu : functionMenus) {
            List<MenuVO> menuList = functionMenu.getMenuList();
            menus.addAll(menuList);
        }
        return menus;
    }
}
